package com.library.service;

import com.library.bean.ReaderInfo;
import com.library.dao.ReaderInfoDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class ReaderInfoService {

    @Autowired
    private ReaderInfoDao readerInfoDao;


    public long ReaderInfo(ReaderInfo readerInfo) {

        return readerInfoDao.addReaderInfo(readerInfo);
    }

    public ArrayList<ReaderInfo> readerInfos() {

        return readerInfoDao.getAllReaderInfo();

    }

    public long addReaderInfo(ReaderInfo readerInfo) {
        return readerInfoDao.addReaderInfo(readerInfo);
    }

    public ReaderInfo getReaderInfo(long readerId) {
        return readerInfoDao.getReaderInfo(readerId);
    }

    public boolean editReaderInfo(ReaderInfo readerInfo) {
        return readerInfoDao.editReaderInfo(readerInfo)>0;

    }

    public boolean deleteReaderInfo(long readerId) {
        return readerInfoDao.deleteReaderInfo(readerId)>0;
    }
}
